# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Thomas Arnhold <thomas at arnhold dot org>

pkgname=liborcus
pkgver=0.16.1
pkgrel=7
pkgdesc="File import filter library for spreadsheet documents."
arch=('x86_64')
url="https://gitlab.com/orcus/orcus/blob/master/README.md"
license=('MPL')
depends=('libixion')
makedepends=('boost' 'mdds')
source=(https://kohei.us/files/orcus/src/${pkgname}-${pkgver}.tar.xz
        liborcus_gcc11_1.patch::https://gitlab.com/orcus/orcus/-/commit/50506d534230d90de2b0a2af3fb072428c942a4e.patch
        liborcus_gcc11_2.patch::https://gitlab.com/orcus/orcus/-/commit/3bfa1a000e4639fe68781c584356ceea7c6b1a72.patch
        liborcus_gcc11_3.patch::https://gitlab.com/orcus/orcus/-/commit/5e8fb255dc6bc9b7084a05b8dc24f31417542e5e.patch)
# https://gitlab.com/orcus/orcus/-/releases
sha256sums=('a4b26b320d00bdfc769c3a03ed22bd5ad7e54a93dc6b1d00cd949f8f3519faae'
            'SKIP'
            'SKIP'
            'SKIP')

prepare() {
    cd "${pkgname}"-${pkgver}
    patch -Np1 -i ../liborcus_gcc11_1.patch
    patch -Np1 -i ../liborcus_gcc11_2.patch
    patch -Np1 -i ../liborcus_gcc11_3.patch
}

build() {
    cd "${pkgname}"-${pkgver}
    ./configure --prefix=/usr
    sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
    make
}

check() {
    cd "${pkgname}"-${pkgver}
    make check
}

package() {
    cd "${pkgname}"-${pkgver}
    make DESTDIR="$pkgdir" install
}
